From: Florian Müllner Date: Mon, 18 Jan 2021 23:57:30 +0000 (+0100) Subject: overviewControls: Simplify dash placement X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~616^2^2~581 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=b3c13d612886ad702ef2129600dfbeec67b83282;p=gnome-shell.git overviewControls: Simplify dash placement Now that the dash is always visible, it doesn't make sense to keep it in a separate layer from the main overview group and use a separate spacer actor as a placeholder. Part-of: --- diff --git a/js/ui/overviewControls.js b/js/ui/overviewControls.js index 11f50c27c..a4fee819a 100644 --- a/js/ui/overviewControls.js +++ b/js/ui/overviewControls.js @@ -343,33 +343,14 @@ var DashFader = GObject.registerClass( class DashFader extends FaderControl { _init(dash) { super._init({ - y_expand: true, x_expand: true, - y_align: Clutter.ActorAlign.END, + x_align: Clutter.ActorAlign.CENTER, }); this._dash = dash; this.add_child(this._dash); } - vfunc_allocate(box) { - this.set_allocation(box); - - box = this.get_theme_node().get_content_box(box); - - const availWidth = Math.round(box.get_width()); - const availHeight = Math.round(box.get_height()); - const [, natHeight] = this._dash.get_preferred_height(availWidth); - - const actorBox = new Clutter.ActorBox(); - actorBox.x1 = box.x1; - actorBox.x2 = actorBox.x1 + availWidth; - actorBox.y1 = box.y1; - actorBox.y2 = actorBox.y1 + (this._dash.y_expand ? availHeight : natHeight); - - this._dash.allocate(box); - } - _onWindowDragBegin() { this.fadeHalf(); } @@ -379,31 +360,6 @@ class DashFader extends FaderControl { } }); -var DashSpacer = GObject.registerClass( -class DashSpacer extends Clutter.Actor { - _init(source) { - super._init(); - - this._bindConstraint = new Clutter.BindConstraint({ - source, - coordinate: Clutter.BindCoordinate.SIZE, - }); - this.add_constraint(this._bindConstraint); - } - - vfunc_get_preferred_width(forHeight) { - if (this._bindConstraint) - return this._bindConstraint.source.get_preferred_width(forHeight); - return super.vfunc_get_preferred_width(forHeight); - } - - vfunc_get_preferred_height(forWidth) { - if (this._bindConstraint) - return this._bindConstraint.source.get_preferred_height(forWidth); - return super.vfunc_get_preferred_height(forWidth); - } -}); - var ControlsManager = GObject.registerClass( class ControlsManager extends St.Widget { _init(searchEntry) { @@ -416,7 +372,6 @@ class ControlsManager extends St.Widget { this.dash = new Dash.Dash(); this._dashFader = new DashFader(this.dash); - this._dashSpacer = new DashSpacer(this._dashFader); let workspaceManager = global.workspace_manager; let activeWorkspaceIndex = workspaceManager.get_active_workspace_index(); @@ -452,8 +407,6 @@ class ControlsManager extends St.Widget { }); this.add_actor(this._group); - this.add_actor(this._dashFader); - const box = new St.BoxLayout({ x_expand: true, y_expand: true, @@ -462,7 +415,7 @@ class ControlsManager extends St.Widget { box.add_child(this._thumbnailsSlider); this._group.add_child(box); - this._group.add_actor(this._dashSpacer); + this._group.add_actor(this._dashFader); this.connect('destroy', this._onDestroy.bind(this)); }